package cn.kp.learning.service.Impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cn.kp.learning.dao.RolesDao;
import cn.kp.learning.model.Roles;
import cn.kp.learning.model.RolesExample;
import cn.kp.learning.service.IdGeneratorService;
import cn.kp.learning.service.RolesService;
@Service("roleService")
public class RolesServiceImpl implements RolesService {

	@Resource
	private RolesDao rolesDao;

	@Resource
	private IdGeneratorService idGeneratorService;
	
	@Override
	public int addRoles(Roles rl) {
		int roleNum = idGeneratorService.selectByCode("roles");
		rl.setRolesId(""+(10000 +roleNum));
		return rolesDao.insertSelective(rl);
	}

	@Override
	public int deleteRoles(String RoleId) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int modifyRoles(Roles rl) {
		// TODO Auto-generated method stub
		return rolesDao.updateByPrimaryKeySelective(rl);
	}

	@Override
	public Roles selectRole(String RoleName, String RoleId) {
		// TODO Auto-generated method stub
		return rolesDao.selectByPrimaryKey(1);
	}

	@Override
	public List<Roles> selectRoles(RolesExample example) {
		// TODO Auto-generated method stub
		return rolesDao.selectByExample(example);
	}

}
